import 'package:intl/intl.dart';
import 'package:intl/date_symbol_data_local.dart';

class DateFormatTool {
  static String get defaultLocale => "zh";

  static initLocale() {
    initializeDateFormatting(defaultLocale);
  }

  static String datetime(int timestamp) {
    initLocale();
    var date = new DateTime.fromMillisecondsSinceEpoch(timestamp * 1000);
    return DateFormat.yMd(defaultLocale).add_Hms().format(date);
  }

  static String dateWeekDay(int timestamp) {
    initLocale();
    var date = new DateTime.fromMillisecondsSinceEpoch(timestamp * 1000);
    return DateFormat.yMMMEd(defaultLocale).format(date);
  }
}
